/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Controlador;
import com.thoughtworks.xstream.XStream;
import java.io.FileWriter;
import java.io.FileReader;
/**
 *
 * @author Carlos
 */
public class XMLar {
        public static void serializar(Object objeto,String archivo){
            XStream xs=new XStream();
            try {
                FileWriter fw=new FileWriter(archivo);
                String temp=xs.toXML(objeto);
                fw.write(temp);
                fw.close();
            }
            catch (Exception e){}
        }
        public static Object leer(String archivo){
            Object objeto=null;
            try {
                XStream xs = new XStream();
                FileReader fr = new FileReader(archivo);
                objeto=xs.fromXML(fr);
            } catch (Exception e) {
                System.out.println(e.toString());
            }
            return objeto;
        }
}

